package io.mft.commons.function.response.kv;

import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.ObjectUtil;
import io.mft.commons.function.FunctionResponseType;
import io.mft.commons.function.IFunctionResponse;

public class KVMap extends Dict implements IFunctionResponse {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6666687547993853909L;

	@Override
	public FunctionResponseType responseType() {
		return FunctionResponseType.kv;
	}

	public String getString(String key, String defaultValue) {
		if (ObjectUtil.isEmpty(get(key))) {
			return defaultValue;
		} else {
			return getStr(key);
		}
	}
	
	public int getInt(String key, int defaultValue) {
		if (ObjectUtil.isEmpty(get(key))) {
			return defaultValue;
		} else {
			return getInt(key);
		}
	}
}
